import java.math.BigInteger;


public class Op implements Node{

	public String token = "<op>";
	public Node no= null;
	public Node id= null;
	public Node exp = null;

			
	public Op(){
		int token = PSTree.Core_TK.getToken();
		// can only be int, id, (
		if(token == 31){
			this.no = new No();
			// if it's integer, no need to check
			
		}
		else if (token == 32){
			
			this.id = new Id();
			
			
		}
		else if (token == 20){
			PSTree.Core_TK.skipToken(); // skip (
			
			this.exp = new Exp();
			 
			token = PSTree.Core_TK.getToken();
			//System.out.println("TOKEN"+token);
			PSTree.Core_TK.skipToken();  // skip )
			if (token != 21){
				System.out.println("Error: missing \")\"");
				System.exit(1);
			}
			
		}
		else{
			System.out.println("Error: unexpected token: " + token);
			System.exit(1);
		}
	}


	@Override
	public void print(int indent) {
		if(no != null){
			this.no.print(indent);
		}
		else if(id != null){
			this.id.print(indent);
		}
		else if(exp != null){
			System.out.print("(");
			this.exp.print(indent);
			System.out.print(")");
		}
		
	}


	
	public void execute() {
		// TODO Auto-generated method stub
		
	}


	@Override
	public BigInteger intexecute() {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public boolean compexecute() {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public String Stringexcec() {
		// TODO Auto-generated method stub
		return null;
	}
}
